package config

import (
	"gopkg.in/ini.v1"
	"log"
)

var c = new(Config)

type Config struct {
	Host Host `ini:"host"`
}

type Host struct {
	Ip              []string `ini:"ip"`
	Username        string   `ini:"username"`
	Port            int      `ini:"port"`
	Password        string   `ini:"password"`
	Key             string   `ini:"key"`
	CipherList      []string `ini:"cipherList"`
	KeyExchangeList []string `ini:"keyExchangeList"`
}

func ParseConfig(path string) {

	err := ini.MapTo(c, path)
	if err != nil {
		log.Fatal("config load error:", err)
	}
	//log.Println(c)
}

func GetCfg() *Config {
	return c
}
